package org.dubnation.org.controller;

import org.dubnation.base.annotation.DubnationPermission;
import org.dubnation.base.util.AjaxResult;
import org.dubnation.org.domain.Manager;
import org.dubnation.org.service.IManagerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@DubnationPermission(name = "部门主管管理")
@RestController
@Api(value = "部门主管",description = "部门主管的操作")
@RequestMapping("/manager")
public class ManagerController {

    @Autowired
    private IManagerService service;

    @DubnationPermission(name = "查询所有部门主管")
    @ApiOperation(value = "查询所有部门主管")
    @GetMapping
    public AjaxResult queryAll() {
        try {
            List<Manager> managers = service.queryAll();
            return AjaxResult.success(managers);
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error();
        }
    }
}
